﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using blackhouse.BlackApart.Business;
using blackhouse.BlackApart.Business.Cities;
using blackhouse.BlackApart.Web;
using blackhouse.BlackApart.Web.Navigation;
using blackhouse.mojoPortalExtend;
using mojoPortal.Business;

namespace blackhouse.Aparts.Web.Navigation {
    public class CmsUrlSearchStateVisitor : UrlVisitor, ISearchStateVisitor {

        public void Apply(SearchState search) {
            PageProvider pageProv = new mojoPortalExtend.PageProvider();
            PageSettings ps = pageProv.FindCmsPageByFunctionality("apartments");
            if (ps != null) {
                this.Url = PageProvider.AdjustUrlToCurrentSite(ps.Url);
                if (search.IsSet)
                    this.Url = this.Url + "?search=" + search;
            }
        }

    }
}